using System;
using UnityEngine;
using UnityEngine.UI;

public class LuckyBtn : MonoBehaviour
{
	private Animator _animator;

	public Button button;

	public Text _countDown;

	public int type;

	private bool m_CanPlayVedio;

	private void Start()
	{
		_animator = base.gameObject.GetComponent<Animator>();
		if (_animator != null)
		{
			_animator.enabled = true;
		}
		Refresh();
		InvokeRepeating("Refresh", 1f, 1f);
		base.gameObject.SetActive(!NewBie.instance.enable);
	}

	public void CheckADVedioReady()
	{
		m_CanPlayVedio = AdManagerOld.instance.curAd.HasVideo();
		base.gameObject.SetActive(m_CanPlayVedio);
	}

	private void Refresh()
	{
		if (EternalNode.Instance.lastDrawVideoTime > 0)
		{
			TimeSpan drawDateTimeSpan = EternalNode.Instance.GetDrawDateTimeSpan();
			if (drawDateTimeSpan.TotalSeconds > 0.0)
			{
				if (_animator != null)
				{
					_animator.enabled = false;
				}
				if (button != null)
				{
					button.interactable = false;
				}
				_countDown.text = $"{drawDateTimeSpan.Minutes:D2}" + ":" + $"{drawDateTimeSpan.Seconds:D2}";
			}
			else
			{
				if (_animator != null)
				{
					_animator.enabled = true;
				}
				if (button != null)
				{
					button.interactable = true;
				}
				_countDown.text = ((type != 0) ? HOLocalizationConfiguration.GetValue(449) : "幸运");
			}
		}
		else
		{
			if (_animator != null)
			{
				_animator.enabled = AdManagerOld.instance.curAd.HasVideo();
			}
			if (button != null)
			{
				button.interactable = true;
			}
			_countDown.text = ((type != 0) ? HOLocalizationConfiguration.GetValue(449) : "幸运");
		}
	}

	private void Update()
	{
	}
}
